package org.dandsoft.blackbox.evolution.processes;

import org.dandsoft.blackbox.mapreduce.client.task.*;
import org.dandsoft.blackbox.evolution.BoxNet;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class ActivationTask extends Task {

    public final static String INPUT_SIGNALS = "signal.input";

    public final static String OUTPUT_SIGNALS = "signal.output";

    public final static String ACTIVATE_SIGNALS = "signal.activate";

    public final static String BUFFER_SIGNALS = "signal.buffer";

    public ActivationTask() {
        this(null);
    }

    public ActivationTask(BoxNet net) {
        InputInfo input = new InputInfo();
        OutputInfo output = new OutputInfo();
        RegisterInfo buffer = new RegisterInfo();

        MapReduceInfo activateInfo = new MapReduceInfo();
        ActivationOperation operation = new ActivationOperation();
        operation.setNet(net);
        activateInfo.setOperation(operation);

        addAction(INPUT_SIGNALS, ActionType.Input, input);
        addAction(OUTPUT_SIGNALS, ActionType.Output, output);
        addAction(BUFFER_SIGNALS, ActionType.Register, buffer);
        addAction(ACTIVATE_SIGNALS, ActionType.MapReduce, activateInfo);

        addDependency(ACTIVATE_SIGNALS, INPUT_SIGNALS);
        addDependency(ACTIVATE_SIGNALS, BUFFER_SIGNALS);

        addDependency(OUTPUT_SIGNALS, ACTIVATE_SIGNALS);
        addDependency(BUFFER_SIGNALS, ACTIVATE_SIGNALS);
    }

}
